#ifndef LIBVDN_EVENT_H
#define LIBVDN_EVENT_H

#pragma once
#include <wx/event.h>





class libvdnEvent : public wxNotifyEvent
{

public:
	enum DownloadSTATUS
	{
		DOWNLOAD_NONE = -2,				// No Status
		DOWNLOAD_FAIL = -1,				// Failed to download the file
		DOWNLOAD_RUNNING = 0,			//Download is currently running
		DOWNLOAD_COMPLETE = 1,			// Download has completed
		DOWNLOAD_INPROGRESS = 2			// Number of bytes downloaded notification.
	};


	private:
	DownloadSTATUS e_DownloadStatus;	// download current status value from the DownloadSTATUS enum
	wxString e_sUrl;					// Url from where to download the file
	wxString e_sFile;					// local file name where the downloaded file would be saved
	unsigned int e_DownloadedPercent;			// Percent of file downloaded
	unsigned int e_DownloadedBytes;
	unsigned int e_TotalFileSize;			// The size of the downloading file.
	int e_ErrorCode;
	wxString e_CustMsg;
	wxWindow *e_parent;

public:

	//constructor 
	libvdnEvent(wxEventType commandType = wxEVT_NULL, int id = 0 );

	//copy constructor
	libvdnEvent(const libvdnEvent& event);

	//destructor
	virtual ~libvdnEvent();

public:

	//returns copy of itself as required with wxPostEvent()
	virtual wxEvent *Clone() const
		{ return new libvdnEvent(*this); }

	//get the current download status
	int GetDownloadStatus();

	//return the url from where the video is downloaded
	wxString GetDownloadUrl();
	
	//return the error code
	int GetErrorCode();

	//return a custom error message set for debugging purposes usually
	wxString GetCustomMessage();

	//return the filename of the downloaded video
	wxString GetDownloadFName();

	//return percent of file that's been downloaded
	int GetDownloadedPercent();

	//return total bytes downloaded
	int GetDownloadedBytes();

	//return total bytes in the file
	int GetTotalBytes();

	//return parent window
	wxWindow* GetParentWindow();

public:  //might need to change this to private for safety, but for now public so the 
		//"C" parts of the lib can use it

	//set the current download status
	void SetDownloadStatus(int);

	//set the url from where the file is downloaded
	void SetDownloadUrl(wxString);
	void SetDownloadUrl(const char url);

	//set the error code that is returned
	void SetErrorCode(int code);

	//set a custom message usually used for debugging
	void SetCustomMessage(wxString msg);

	//set the filename for the video once downloaded
	void SetDownloadFName(wxString);
	void SetDownloadFName(const char fname);

	//set the percent of the file that's been downloaded
	void SetDownloadedPercent(int);

	//set the amount of bytes that have been downloaded
	void SetDownloadedBytes(int);

	//set the total amount of bytes to be downloaded
	void SetTotalBytes(int);

	//set the parent window
	void SetParentWindow(wxWindow *parent);

private:

	DECLARE_DYNAMIC_CLASS(libvdnEvent);
};

typedef void (wxEvtHandler::*libvdnEventFunction)(libvdnEvent&);

/**
 * Declares the event types to be used by the user in their event tables.
 */
BEGIN_DECLARE_EVENT_TYPES()
    DECLARE_EVENT_TYPE(wxEVT_DOWNLOAD, wxID_EVENT_DOWNLOAD)
END_DECLARE_EVENT_TYPES()

#define EVT_DOWNLOAD(fn) DECLARE_EVENT_TABLE_ENTRY( \
	wxEVT_DOWNLOAD, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) \
	(libvdnEventFunction) & fn, (wxObject *) NULL ),


#endif


